# Contributor: Andy Postnikov <apostnikov@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php8-pecl-event
_extname=event
pkgver=3.0.8
pkgrel=0
pkgdesc="PHP 8.0 extension that provides interface to libevent library - PECL"
url="https://pecl.php.net/package/event"
arch="all"
license="PHP-3.01"
depends="php8-sockets"
makedepends="php8-dev libevent-dev openssl1.1-compat-dev pkgconf"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

build() {
	phpize8
	./configure --prefix=/usr --with-php-config=php-config8
	make
}

check() {
	# Tests require sockets extension which is not bundled
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 SKIP_ONLINE_TESTS=1 test \
		TESTS=--show-diff \
		PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=/usr/lib/php8/modules/sockets.so \
		-d extension=modules/$_extname.so"
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php8/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
45b4c07cac6dfca386cf9e6c792abc72c6f68d1443a1c67fd645f5e6f05ae9d45fb346b50b35cc6818ca70ebbff93c42afd801e70e9ebc63f997366996193593  php-pecl-event-3.0.8.tgz
"
